<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./ajax.js"></script>
    <title>Document</title>
    <style>
        .box{
            padding-top: 20px;
            width: 500px;
            height: 260px;
            background-color: #666;
            text-align: center;
            position: absolute;
            left: 50%;
            top: 150px;
            transform: translate(-50%);
        }
        h3{
            color: #fff;
        }
        body{
            background-color: #ccc;
            position: relative;
        }
        .box label{
            display: inline-block;
            width: 64px;
            text-align: right;
            color: #fff;
        }
        button{
            width: 60px;
            height: 30px;
        }
    </style>
</head>
<body>
    <div class="box">
        <h3>普通公司管理系统</h3>
        <p><label for="n">用户名：</label><input type="text" value="" id="n"></p>
        <p><label for="m">密码：</label><input type="text" value="" id="m"></p>
        <button id="bn">登录</button>
    </div>
</body>
<script>
    document.getElementById("bn").onclick=function(){
        var n=document.getElementById("n").value
        var m=document.getElementById("m").value
        var xmlHttp=new XMLHttpRequest();
        xmlHttp.open("post","http://www.qhdlink-student.top/student/login.php");
        xmlHttp.setRequestHeader("content-type","application/x-www-form-urlencoded");
        var a=("username="+n+"&userpwd="+m+"&userclass=70&type=4");
        xmlHttp.send(a)
        xmlHttp.onreadystatechange=function(){
            if(xmlHttp.readyState===4 && xmlHttp.status===200){
                var data=xmlHttp.responseText
                if(data=="ok"){
                    location.href="22.html"
                    sessionStorage.zz="1"
                }else{
                    alert("错误")
                }
            }
        }
    }
</script>
</html>